package station;

import java.util.Random;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Random random = new Random(System.currentTimeMillis());
        Vehicle[] vehicles = new Vehicle[]{
                new Bus(4000,"京BK2193",5),
                new Bus(6000,"粤AK1929",7),
                new Truck(8000,"粤BT1291",6500,3),
                new Truck(9000,"粤SJ9900",8500,2),
                new Truck(9000,"粤A12345",9500,5),
                new MoBy()
        };
        for (Vehicle vehicle:vehicles) {
            System.out.println("\n欢迎进入高速公路车辆收费系统");
            System.out.println("请确认车牌号："+vehicle.getPlateNo()+"(1、是 2、否)");
            if (input.nextInt() != 1){
                System.out.println("您的车牌号有误，请与交警联系！");
                continue;
            }
            vehicle.print();
            int kilos = random.nextInt(200-50+1)+50;
            System.out.println("您行驶的公里数是"+kilos);
            System.out.println("您的车辆需要缴费"+kilos*vehicle.getRate()+"元。");
        }
    }
}
